home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 6
/
FM Towns Free Software Collection 6.iso
/
t_os
/
tv_towns
/
tv_towns.asm
next >
Wrap
Assembly Source File
|
1993-07-08
|
17KB
|
928 lines
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;
; 超高速版:Towns Real Time effecter & Television
;
; Version 1.04a (1992/11/27改定)
;
;
; 動作環境:FM-TOWNS + TOWNS_OS or MS_DOS+DOS|Extender+TBIOS
; v1.1,v2.1
;
; 開発言語:386|ASM Tool kit V2.2
;
;
; Program by Ken inoue.(C)1991
;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386p
EGB equ 0020h
MB equ 0040h
MSR equ 0048h
SB equ 0080h
stack segment dword stack use32 'stack'
_stack db 1024*50 dup(?)
stack ends
_data segment dword public use32 'data'
EGB_WORK db 1536 dup(0)
MOUSE_WORK db 4096 dup(0)
_data ends
tv_towns segment dword public use32 'code'
assume cs:tv_towns,ds:nothing
;------------------------------------------
db ' TV_TOWNS '
db ' Version 1.04a '
db ' '
db 'Programmed by '
db ' Ken Inoue.'
;-------------------------------------------
tt_proc proc near
push ds
push es
push fs
push 0110h
pop fs
xor ah,ah ; EGB初期化
lea edi,EGB_WORK
mov ecx,1536
call pword ptr fs:[EGB]
mov ax,0100h; 仮想画面の設定
mov dx,9
call pword ptr fs:[EGB]
mov ax,0101h
mov dx,9
call pword ptr fs:[EGB]
mov ax,0500h; 書き込みページの設定(ページ0)
call pword ptr fs:[EGB]
mov ax,0601h; 表次頁の設定(ページ1優先)
mov edx,11b
call pword ptr fs:[EGB]
mov ax,1B01h; ディジタイズ指定
call pword ptr fs:[EGB]
xor ah,ah ; MouseBios初期化
lea edi,MOUSE_WORK
mov ecx,4096
call pword ptr fs:[MB]
mov ah,7 ;水平移動範囲指定
mov dx,0
mov bx,180
call pword ptr fs:[MB]
mov ah,8 ;垂直移動範囲指定
mov dx,0
mov bx,120
call pword ptr fs:[MB]
mov ah,44h ; SoundBios 電子ボリューム初期化
call pword ptr fs:[SB]
mov ah,43h
mov bl,0 ;ライン・イン
mov dx,07F7Fh
call pword ptr fs:[SB]
mov ah,0 ; キーボード初期化
int 90h
mov ax,0501h; クリック音無し
int 90h
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
#init: mov ax,1Ch ; 画面クリア
mov ds,ax
mov es,ax
mov eax,10000000000000001000000000000000b
mov edi,40000h
mov ebx,360*2/4
mov edx,400h-(360*2)
mov ebp,240
align 4
#rep_: mov ecx,ebx
rep stosd
add edi,edx
dec ebp
jne short #rep_
#key_check: mov ax,0901h
int 90h
xor dh,0FFh
je short #key_check
#key: cmp dl,"0" ; キ-入力判定
je #color_0
cmp dl,"1"
je #color_8
cmp dl,"2"
je #color_64
cmp dl,"3"
je #color_512
cmp dl,"4"
je #color_4096
; cmp dl,"5"
; je #color_32768
cmp dl,"6"
je #color_green
cmp dl,"7"
je #color_red
cmp dl,"8"
je #color_blue
cmp dl,"9"
je #color_nega
cmp dl,"*"
je #color_yellow
cmp dl,"Y"
je #color_yellow
cmp dl,"y"
je #color_yellow
cmp dl,"/"
je #color_violet
cmp dl,"V"
je #color_violet
cmp dl,"v"
je #color_violet
cmp dl,"+"
je #color_skyblue
cmp dl,"S"
je #color_skyblue
cmp dl,"s"
je #color_skyblue
cmp dl,"-"
je #jmp_mosaic1
cmp dl,"Z"
je #jmp_mosaic1
cmp dl,"z"
je #jmp_mosaic1
cmp dl,"="
je #jmp_mosaic2
cmp dl,"X"
je #jmp_mosaic2
cmp dl,"x"
je #jmp_mosaic2
cmp dl,"."
je #jmp_mosaic3
cmp dl,"C"
je #jmp_mosaic3
cmp dl,"c"
je #jmp_mosaic3
cmp dl,"K"
je #jt_koma1
cmp dl,"k"
je #jt_koma1
cmp dl,"L"
je #jt_koma2
cmp dl,"l"
je #jt_koma2
cmp dl,";"
je #jt_koma3
cmp dl,"I"
je #jt_koma21
cmp dl,"i"
je #jt_koma21
cmp dl,"O"
je #jt_koma22
cmp dl,"o"
je #jt_koma22
cmp dl,"P"
je #jt_koma23
cmp dl,"p"
je #jt_koma23
cmp dl,"R"
je #reverse
cmp dl,"r"
je #reverse
cmp dl,"M"
je monotone
cmp dl,"m"
je monotone
cmp dl,""
je zoom_up
cmp dl,""
je zoom_up2
cmp dl,""
je zoom_up3
cmp dl,"Q"
je multi1
cmp dl,"q"
je multi1
cmp dl,"W"
je multi2
cmp dl,"w"
je multi2
cmp dl,"E"
je multi3
cmp dl,"e"
je multi3
cmp dl,13 ;return_key
je quit
jmp #init
;===== Table for jump =====
#color_0: mov ebp,10000000000000000000000000000000b ;論理演算用
jmp draw_main1
#color_8: mov ebp,11000010000100001100001000010000b ;論理演算用
jmp draw_main1
#color_64: mov ebp,11100011000110001110001100011000b ;論理演算用
jmp draw_main1
#color_512: mov ebp,11110011100111001111001110011100b ;論理演算用
jmp draw_main1
#color_4096: mov ebp,11111011110111101111101111011110b ;論理演算用
jmp draw_main1
;#color_32768: mov ebp,11111111111111111111111111111111b ;論理演算用
; jmp draw_main1
#color_green: mov ebp,11111100000000001111110000000000b ;論理演算用
jmp draw_main1
#color_red: mov ebp,10000011111000001000001111100000b ;論理演算用
jmp draw_main1
#color_blue: mov ebp,10000000000111111000000000011111b ;論理演算用
jmp draw_main1
#color_yellow: mov ebp,11111111111000001111111111100000b ;論理演算用
jmp draw_main1
#color_violet: mov ebp,10000011111111111000001111111111b ;論理演算用
jmp draw_main1
#color_skyblue: mov ebp,11111100000111111111110000011111b ;論理演算用
jmp draw_main1
#color_nega: mov ebp,01111111111111110111111111111111b ;論理演算用
jmp draw_main2
#jt_koma1: mov ebp,2
jmp #koma
#jt_koma2: mov ebp,6
jmp #koma
#jt_koma3: mov ebp,12
jmp #koma
#jt_koma21: mov ebp,6
jmp #koma2
#jt_koma22: mov ebp,12
jmp #koma2
#jt_koma23: mov ebp,18
jmp #koma2
#jmp_mosaic1: mov bx,1919h
jmp #mosaic
#jmp_mosaic2: mov bx,5F5Fh
jmp #mosaic
#jmp_mosaic3: mov bx,0FFFFh
jmp #mosaic
;===== draw main1 =====
align 4
draw_main1: xor eax,eax ;画面クリア
mov edi,40000h
mov esi,400h-(360*2)
mov bl,240
align 4
#clr:
mov bh,360/2/15
align 4
#clrr:
REPT 15
and [edi],ebp
add edi,4
ENDM
dec bh
jne short #clrr
add edi,esi
dec bl
jne short #clr
call screen_side_clear
mov dx,0458h ;Packed pixel mask register set.
mov al,0
out dx,al
mov dx,045Ah
mov ax,bp
out dx,ax
shr ebp,16
mov dx,0458h
mov al,1
out dx,al
mov dx,045Ah
mov ax,bp
out dx,ax
align 4
#repeat1: mov esi,20
mov edi,40000h+20
mov eax,(360-12)*2/4
mov ebx,400h-(360-12)*2
REPT 240
mov ecx,eax
rep movsd
add esi,ebx
add edi,ebx
ENDM
mov ax,0901h
int 90h
xor dh,0FFh
je #repeat1
push dx
mov dx,0458h ;Packer pixel mask register clear.
mov al,0
out dx,al
mov dx,045Ah
mov ax,0FFFFh
out dx,ax
shr ebp,16
mov dx,0458h
mov al,1
out dx,al
mov dx,045Ah
mov ax,0FFFFh
out dx,ax
pop dx
jmp #key
;===== dram main2 =====
draw_main2: call screen_side_clear
align 4
#repeat2: mov dl,240
mov ecx,400h-(360*2-24)
mov esi,20 ;(本当は12だが表示の関係で右へずらす)
mov edi,40000h+20
align 4
#rep1:
REPT (360-12)*2/4 ;ここが高速化のポイントだ!
lodsd
xor eax,ebp
stosd
ENDM
add esi,ecx
add edi,ecx
dec dl
jne #rep1
mov ax,0901h
int 90h
xor dh,0FFh
je #repeat2
jmp #key
;===== mosaic =====
align 4
#mosaic: mov dx,0440h ;SETTING ZOOM
mov al,1Bh
out dx,al
mov dx,0442h
mov ax,bx
out dx,ax
call clear_screen
#mosaic_: mov ax,0901h
int 90h
xor dh,0FFh
je #mosaic_
push dx
mov dx,0440h ;SETTING ZOOM
mov al,1Bh
out dx,al
mov dx,0442h
mov ax,0303h
out dx,ax
pop dx
jmp #key
;===== koma-okuri mode =====
align 4
#koma: call vsync_check
mov dx,0440h ;SETTING CTRL0
mov al,28
out dx,al
mov dx,0442h
mov ax,1100000010000101b
out dx,ax
call vsync_check
mov dx,0440h ;SETTING CTRL0
mov al,28
out dx,al
mov dx,0442h
mov ax,1100000001000101b
out dx,ax
mov ecx,ebp ; ebp -- wait
#k_wait: call vsync_check
loop #k_wait
mov ax,0901h
int 90h
xor dh,0FFh
je #koma
jmp #key
;===== koma-okuri mode2 =====
align 4
#koma2: call vsync_check
mov dx,0440h ;SETTING CTRL0
mov al,28
out dx,al
mov dx,0442h
mov ax,1100000010000101b
out dx,ax
mov ecx,ebp ; ebp -- wait
#k_wait2: call vsync_check
loop #k_wait2
mov dx,0440h ;SETTING CTRL0
mov al,28
out dx,al
mov dx,0442h
mov ax,1100000001000101b
out dx,ax
mov ecx,ebp ; ebp -- wait
#k_wait2_: call vsync_check
loop #k_wait2_
mov ax,0901h
int 90h
xor dh,0FFh
je #koma2
jmp #key
;===== Reverse mode =====
#reverse: call screen_side_clear
align 4
#rev: mov esi,20
mov edi,40000h+20+400h*239
mov eax,(360-12)*2/4
mov ebx,400h-(360-12)*2
mov ebp,400h+(360-12)*2
mov dl,240/80
align 4
#r_rep:
REPT 80
mov ecx,eax
rep movsd
add esi,ebx
sub edi,ebp
ENDM
dec dl
jne #r_rep
mov ax,0901h
int 90h
xor dh,0FFh
je #rev
jmp #key
;===== monotone screen ===== ; 処理が手抜きでゴメンナサイ(^_^;)
monotone: call screen_side_clear
align 4
#monotone: mov ebp,01111100000000000111110000000000b
align 4
#monotone_: mov cx,240*100h+5
mov edx,400h-(360*2-24)
mov esi,20
mov edi,40000h+20
align 4
#mn_rep0:
REPT (360-12)*2/4 ;ここが高速化のポイントだ!
lodsd
and eax,ebp
mov ebx,eax
shr eax,cl
xor eax,ebx
shr eax,cl
xor eax,ebx
stosd
ENDM
add esi,edx
add edi,edx
dec ch
jne #mn_rep0
mov ax,0901h
int 90h
xor dh,0FFh
je #monotone_
jmp #key
;===== ZOOM UP mode =====
align 4
zoom_up: mov ah,7 ;水平移動範囲指定
mov dx,0
mov bx,180
call pword ptr fs:[MB]
mov ah,8 ;垂直移動範囲指定
mov dx,0
mov bx,120
call pword ptr fs:[MB]
align 4
#zoom_up: call pword ptr fs:[MSR]
mov ah,03h ;位置読み取り
call pword ptr fs:[MB]
movzx eax,dx
movzx esi,bx
imul esi,400h ;SourceVRAM座標算出
shl eax,1
add esi,eax
mov edi,40000h ;DestinationVRAM座標(^^;)
mov ebp,400h-4 ;work
mov edx,400h
mov ecx,120/2
;拡大率は、2倍
align 4
#drawing: push ecx
mov cl,16
REPT 2
REPT 180
lodsw
mov ebx,eax ;この方が早い
shl eax,cl
mov ax,bx
stosd
add edi,ebp
stosd
sub edi,edx
ENDM
add esi,400h-180*2
add edi,800h-360*2
ENDM
pop ecx
dec ecx
jnz #drawing
mov ax,0901h
int 90h
xor dh,0FFh
je #zoom_up
jmp #key
;===== ZOOM UP mode2 =====
align 4
zoom_up2: mov ah,7 ;水平移動範囲指定
mov dx,0
mov bx,240
call pword ptr fs:[MB]
mov ah,8 ;垂直移動範囲指定
mov dx,0
mov bx,160
call pword ptr fs:[MB]
#zoom_up2: call pword ptr fs:[MSR]
mov ah,03h ;位置読み取り
call pword ptr fs:[MB]
movzx eax,dx
movzx esi,bx
imul esi,400h ;SourceVRAM座標算出
shl eax,1
add esi,eax
mov edi,40000h ;DestinationVRAM座標(^^;)
mov ebp,400h-6 ;work
mov edx,400h*2
mov ecx,80/2
;拡大率は、3倍
align 4
#drawing2: push ecx
mov cl,16
REPT 2
REPT 120
lodsw
mov ebx,eax ;この方が早い
shl eax,cl
mov ax,bx
stosd
stosw
add edi,ebp
stosd
stosw
add edi,ebp
stosd
stosw
sub edi,edx
ENDM
add esi,400h-120*2
add edi,400h*3-360*2
ENDM
pop ecx
dec ecx
jnz #drawing2
mov ax,0901h
int 90h
xor dh,0FFh
je #zoom_up2
jmp #key
;===== ZOOM UP mode3 =====
align 4
zoom_up3: mov ah,7 ;水平移動範囲指定
mov dx,0
mov bx,270
call pword ptr fs:[MB]
mov ah,8 ;垂直移動範囲指定
mov dx,0
mov bx,180
call pword ptr fs:[MB]
#zoom_up3: call pword ptr fs:[MSR]
mov ah,03h ;位置読み取り
call pword ptr fs:[MB]
movzx eax,dx
movzx esi,bx
imul esi,400h ;SourceVRAM座標算出
shl eax,1
add esi,eax
mov edi,40000h ;DestinationVRAM座標(^^;)
mov ebp,400h-8 ;work
mov edx,400h*3
mov ecx,60
;拡大率は、4倍
align 4
#drawing3: push ecx
mov cl,16
REPT 90
lodsw
mov ebx,eax ;この方が早い
shl eax,cl
mov ax,bx
stosd
stosd
add edi,ebp
stosd
stosd
add edi,ebp
stosd
stosd
add edi,ebp
stosd
stosd
sub edi,edx
ENDM
add esi,400h-90*2
add edi,400h*4-360*2
pop ecx
dec ecx
jnz #drawing3
mov ax,0901h
int 90h
xor dh,0FFh
je #zoom_up3
jmp #key
;===== multi_screen ===== ;16画面マルチ表示
align 4
multi1: mov ebx,6 ;work
mov edx,400h*4-360*2 ;work
mov ebp,400h-(360*2)/4 ;work
mov eax,40000h ;destin.VRAM_ADDRESS
REPT 4
mov edi,eax
mov esi,0 ;source VRAM_ADDRESS
push eax
call #multi1s
pop eax
add eax,0B4h
ENDM
mov eax,4F000h ;destin.VRAM_ADDRESS
REPT 4
mov edi,eax
mov esi,0 ;source VRAM_ADDRESS
push eax
call #multi1s
pop eax
add eax,0B4h
ENDM
mov eax,5E000h ;destin.VRAM_ADDRESS
REPT 4
mov edi,eax
mov esi,0 ;source VRAM_ADDRESS
push eax
call #multi1s
pop eax
add eax,0B4h
ENDM
mov eax,6D000h ;destin.VRAM_ADDRESS
REPT 4
mov edi,eax
mov esi,0 ;source VRAM_ADDRESS
push eax
call #multi1s
pop eax
add eax,0B4h
ENDM
mov ax,0901h
int 90h
xor dh,0FFh
je multi1
jmp #key
align 4 ;--sub routine start
#multi1s: mov ecx,60/5
align 4
#loop_multi1a:
REPT 5
REPT 360/4
movsw
add esi,ebx
ENDM
add esi,edx
add edi,ebp
ENDM
dec ecx
jne #loop_multi1a
ret ;--sub routine end
;===== multi_screen ===== ;4画面マルチ表示
align 4
multi2:
mov ebx,4 ;work
; mov ebx,2 ;work
mov edx,400h*2-360*2 ;work
mov ebp,400h-(360*2)/2 ;work
mov esi,0 ;source VRAM_ADDRESS
mov edi,40000h ;destin.VRAM_ADDRESS
call short #multi2s
mov esi,0 ;source VRAM_ADDRESS
mov edi,40168h ;destin.VRAM_ADDRESS
call short #multi2s
mov esi,0 ;source VRAM_ADDRESS
mov edi,5E000h ;destin.VRAM_ADDRESS
call short #multi2s
mov esi,0 ;source VRAM_ADDRESS
mov edi,5E168h ;destin.VRAM_ADDRESS
call short #multi2s
mov ax,0901h
int 90h
xor dh,0FFh
je multi2
jmp #key
align 4 ;--sub routine start
#multi2s: mov ecx,120/4
call #loop_multi3a
ret
;ルーチン共用(下部)
;===== multi_screen ===== ;2画面マルチ表示
align 4
multi3:
mov ebx,4 ;work
; mov ebx,2 ;work
mov edx,400h-360*2 ;work
mov ebp,400h-(360*2)/2 ;work
mov esi,0 ;source VRAM_ADDRESS
mov edi,40000h ;destin.VRAM_ADDRESS
call short #multi3s
mov esi,0 ;source VRAM_ADDRESS
mov edi,40168h ;destin.VRAM_ADDRESS
call short #multi3s
mov ax,0901h
int 90h
xor dh,0FFh
je multi3
jmp #key
align 4 ;--sub routine start
#multi3s: mov ecx,240/4
align 4
#loop_multi3a:
REPT 4
REPT 360/2
mov eax,[esi]
stosw
add esi,ebx
ENDM
add esi,edx
add edi,ebp
ENDM
dec ecx
jne #loop_multi3a
ret ;--sub routine end
;===== screen side clear ===== ; 画面左右の余り部分を未表示にします。
align 4
screen_side_clear:
push ebp
mov edi,40000h
xor eax,eax
mov ebp,(360*2-24)
mov edx,400h-360*2
mov bl,240
align 4
#ssc_rep:
REPT 20/4
stosd
ENDM
add edi,ebp
stosd
add edi,edx
dec bl
jne short #ssc_rep
pop ebp
ret
;===== clear screen =====
align 4
clear_screen:
mov eax,10000000000000001000000000000000b
mov edi,40000h
mov ebx,360*2/4
mov edx,400h-(360*2)
mov ebp,240
align 4
#rep__: mov ecx,ebx
rep stosd
add edi,edx
dec ebp
jne short #rep__
ret
;===== vsync check =====
align 4
vsync_check:
#vsc_1: mov dx,0440h
mov al,30
out dx,al
add dx,2
in ax,dx
test ah,00000100b
jnz short #vsc_1
align 4
#vsc_2: mov dx,0440h
mov al,30
out dx,al
add dx,2
in ax,dx
test ah,00000100b
jz short #vsc_2
ret
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
quit: lea edi,EGB_WORK
mov ax,0100h ;ディジタイズOFF
call pword ptr fs:[EGB]
mov ax,0100h
mov dx,1
call pword ptr fs:[EGB]
mov ax,0101h
mov dx,1
call pword ptr fs:[EGB]
mov ah,1
call pword ptr fs:[MB]
mov eax,0
mov edi,0
mov ecx,400h*256*2/4
rep stosd
pop fs
pop es
pop ds
mov ax,04c00h ; Exit back to MS-DOS.
int 21h ;
;------------------------------------------------------------------------------
tt_proc endp
tv_towns ends
end tt_proc